<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class AssetJournalBusinessTypeEnum
{
    use EnumTrait;

    const UNLOCK_CHARACTER = ['value' => 1, 'text' => '解锁', 'desc' => '解锁AI人物'];
    const UNLOCK_CHARACTER_IMAGE = ['value' => 1, 'text' => '解锁', 'desc' => '解锁AI人物图片'];

    public static function getEnumByValue($value)
    {
        foreach (self::getConstants() as $constant) {
            if ($constant['value'] == $value) {
                return $constant;
            }
        }
        return null;
    }

    public static function getTextByValue($value)
    {
        return self::getEnumByValue($value)['text'] ?? '';
    }

    public static function getValue($data)
    {
        return $data['value'];
    }

    public static function getPublishContentAddScoreType()
    {
        return [self::getValue(self::PUBLISH_TECHNOLOGY), self::getValue(self::PUBLISH_COMMODITY)];
    }
}
